package com.project.bean;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.time.LocalDate;

public class DiscussBean {
    private int id;
    private UserBean userBean;
    private TopicBean topicBean;
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate date=LocalDate.now();
    private String title;
    private String contents;

    public DiscussBean(int userId, int topicId, String title, String contents) {
        this.userBean = new UserBean();
        this.userBean.setId(userId);


        this.topicBean = new TopicBean();
        this.topicBean.setId(topicId);

        this.title = title;
        this.contents = contents;
    }

    @Override
    public String toString() {
        return "DiscussBean{" +
                "id=" + id +
                ", userBean=" + userBean +
                ", topicBean=" + topicBean +
                ", date=" + date +
                ", title='" + title + '\'' +
                ", contents='" + contents + '\'' +
                "}\n";
    }

    public DiscussBean() {
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public UserBean getUserBean() {
        return userBean;
    }

    public void setUserBean(UserBean userBean) {
        this.userBean = userBean;
    }

    public TopicBean getTopicBean() {
        return topicBean;
    }

    public void setTopicBean(TopicBean topicBean) {
        this.topicBean = topicBean;
    }

    public LocalDate getDate() {
        return date;
    }

    public void setDate(LocalDate date) {
        this.date = date;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContents() {
        return contents;
    }

    public void setContents(String contents) {
        this.contents = contents;
    }
}
